/***************************************************************************
 *   Copyright (C) 2007 by vasaka,,,   *
 *   vasaka@gmail.com   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 3 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
#ifndef CLEANCLASS_
#define CLEANCLASS_

#include "clusterpoint.h"
#include <vector>

//different operations with clusters on image
class CleanClass
{
  public:
    CleanClass();
    void LoadImage ( int* img_,int width,int height);//load image do initialization //B&W version
    
    void CleanPaintBackSimpleBW(int* img_);
    void PaintBackNoClean(int* img_);
    void CleanPaintBackBW(int x,int y,int xo,int yo,int width_,int height_);//paint cleaned image back
    void CleanPaintBack(int* img_,int x,int y,int xo,int yo,int width_,int height_);
    void PaintDistribution(int* img_,int width_,int height_,int color_);
    void ExtractAllClasters ( CImage &Image );
    void doProcess();
  protected:
    CImage ImageInClusterFormat_m; //image transferred to BW format to clean;
    struct clInfo
    {
    	clInfo (unsigned int x,unsigned int y,unsigned int sz):startx(x),starty(y),clSize(sz)
    	{}
    	clInfo ():startx(0),starty(0),clSize(0)
    	{}    	
    	unsigned int startx,starty;
    	unsigned int clSize;
    };
    vector<unsigned int> Distribution_m;
    vector<clInfo> clList_m;

    int Height_m;
    int Width_m;
    int* img_m;//img is created externally
    int* imgout_m;
};

#endif /*CLEANCLASS_*/
